<template>
    <div class="Days">
        <h1>第三题</h1>
        <div v-for="val, i in goodsArr" :key="i">
            <dYsIndex :val="val"></dYsIndex>
        </div>
        <br>
        All Number:{{ He }}
    </div>
</template>

<script>
import dYsIndex from '../components/dYs.vue'
export default {
    name: 'Days',
    components: {
        dYsIndex
    },
    data() {
        return {
            goodsArr: [
                {
                    count: 0,
                    goodsName: "Watermelon"
                }, {
                    count: 0,
                    goodsName: "Banana"
                }, {
                    count: 0,
                    goodsName: "Orange"
                }, {
                    count: 0,
                    goodsName: "Pineapple"
                }, {
                    count: 0,
                    goodsName: "Strawberry"
                }
            ]
        }
    },
    computed: {
        He: {
            get() {
                return this.goodsArr.reduce((sum, v) => {
                    // return sum += v.count+v.count
                    return sum += v.count-0
                }, 0)
            },
            set(v) {

            }
        }
    }
}
</script>

<style>

</style>